﻿function script(move_func, shoot_func) {
    // all script should like this.
    return function(that) {
        move_func(that);
        shoot_func(that);
        that.script_time++;
    }
}

function move_0(v1, ang1, v2, ang2, t1) {
    return function(that) {
        if (that.script_time == 0) {
            that.v = v1;
            that.ang = ang1;
        } else if (that.script_time == t1) {
            that.v = v2;
            that.ang = ang2;
        }
        that.x += that.v * cos(that.ang);
        that.y += that.v * sin(that.ang);
    }
}

function shoot_0(bullet_type, cd, v, ang0) {
    return function(that) {
        if (that.script_time % cd == 0) {
            bullet_type(that.x, that.y, v, patan2(that.x, that.y) + rang(ang0));
        }
    }
}
